package com.example.robertluozizhao.java.design.proxy;

import java.lang.reflect.Proxy;

/**
 * Created by Lzz on 4/11/2020.
 */

public class ProxyTextMain {

    public static void main(String[] args){
        ActionClient actionClient = new ActionClient();//委托类
        ActionInvocationHandler actionInvocationHandler = new ActionInvocationHandler(actionClient);

        IActionListen actionListen = (IActionListen) Proxy.newProxyInstance(actionClient.getClass().getClassLoader(),
                actionClient.getClass().getInterfaces(),
                actionInvocationHandler);

        actionListen.click(4,5);
        actionListen.up();

    }

}
